package chess;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Servlet implementation class for Servlet: LeaveHall
 *
 */
 public class LeaveHall extends javax.servlet.http.HttpServlet implements javax.servlet.Servlet {
   static final long serialVersionUID = 1L;
   
    /* (non-Java-doc)
	 * @see javax.servlet.http.HttpServlet#HttpServlet()
	 */
	public LeaveHall() {
		super();
	}   	
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		String pid = request.getParameter("pid");
		GameHall gameHall = (GameHall)(ContextHelper.getInstance().get("GameHall"));
		gameHall.removePlayer(gameHall.getPlayerById(pid));
		
	}   	  	    
}